﻿Public Class frmVaccine
    Dim strsql As String
    Dim mysql As New ClsSQLhelper
    Sub Search_Vaccine()
        With VaccineGrid
            Try
                If Me.TxtVaccine.Text = "" Then
                    MsgBox("กรุณาใส่ รหัส ICD 9 ", MsgBoxStyle.Exclamation)
                    Exit Sub
                End If
                strsql = "Select Code,DESC_R,SEX,AGEDUSE,AGEMIN,AGEMAX from l_icd9 where code =  '" & Me.TxtVaccine.Text & "'"
                Dim DTICD10 As New DataTable
                DTICD10 = mysql.GetMYSQLDataTable(strsql, "l_icd9")

                .RowHeadersVisible = False
                .AllowDrop = False
                .AllowUserToAddRows = False
                .AllowUserToDeleteRows = False
                .AllowUserToOrderColumns = True
                .AllowUserToResizeColumns = True
                .AllowUserToResizeRows = False
                .MultiSelect = False
                .AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells
                .AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells
                .DataSource = DTICD10
                .ReadOnly = True
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End With
    End Sub

    Private Sub BtnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnFind.Click
        Search_Vaccine()
    End Sub

    Private Sub VaccineGrid_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles VaccineGrid.KeyDown
        If e.KeyCode = Keys.Enter Then
            Search_Vaccine()
        End If
    End Sub
End Class